/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.service.impl;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.icinfo.cloud.provider.common.constant.PunishMainServicePortUriConstant;
import com.icinfo.cloud.provider.common.utils.PunishMainClientUtil;
import com.icinfo.cloud.provider.punish.service.ICaseMainEvidenceService;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseAppendEvidenceDto;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.service.support.MyBatisServiceSupport;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * 描述: 案件证据表-trj case_main_evidence 对应的Service接口实现类.<br>
 *
 * @author framework generator
 * @date 2022年02月15日
 */
@Service
public class CaseMainEvidenceServiceImpl extends MyBatisServiceSupport implements ICaseMainEvidenceService {

    @Value("${tzService.url}")
    private String url;

    @Override
    public Result appendEvidence(CaseAppendEvidenceDto caseAppendEvidenceDto) {
        return PunishMainClientUtil.httpPost(PunishMainServicePortUriConstant.APPEND_EVIDENCE, caseAppendEvidenceDto);
    }

    @Override
    public Result getAppendEvidence(String caseId) {
        String response = HttpUtil.createGet(url.concat(PunishMainServicePortUriConstant.GET_APPEND_EVIDENCE+"?caseId="+caseId)).execute().body();
        Result<CaseAppendEvidenceDto> result = JSONObject.parseObject(response, Result.class);
        return result;
    }

}
